<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<style>
    ul {
        list-style: none;
    }

    li {
        border: solid 1px;
        height: 50px;
        width: 100px;
    }
</style>
<ul>
    <li></li>
    <li></li>
    <li></li>
</ul>

</body>
<script>
    const lis = document.querySelectorAll("li");

    for (let li of lis) {
        // console.log(li)
        li.addEventListener('click', function () {
            li.style.backgroundColor = 'red'
        })
    }

</script>
</html>
